package com.example.thread;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class TestParall {

    public static void main(String[] args) throws Exception{
        File directory = new File("D:\\test\\test\\test");
        directory.mkdirs();
        File directory2 = new File("D:\\test\\test\\test");
        directory2.mkdirs();

        SecurityManager securityManager = System.getSecurityManager();
        SecurityManager securityManager1 = System.getSecurityManager();
        System.out.println(securityManager);
        System.out.println(securityManager1);

        // 第二种：获取项目路径
        File file = new File("");
        String path = file.getCanonicalPath();
        System.out.println(path);
    }

    protected void test1(){
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<10000;i++){
            list.add(i);
        }
        list.parallelStream().forEach((e)->{
            File directory = new File("D:\\test\\test\\test");
            if(!directory.exists()){
                directory.mkdirs();
            }
            File file = new File("D:\\test\\test\\test\\"+e+".txt");
            try {
                file.createNewFile();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        });
        System.out.println("========================");
    }
}
